package org.testis.logging;

import org.testis.utils.DateUtils;


/**
 *
 * @author nurhat
 */
public class FileLogData extends LogData
{

    private static final long serialVersionUID = 19820002222563L;
    private String m_logMsg;
    private String m_loggingClass;
    private String m_loggingObjDesc;
    private String m_level;


    public FileLogData(String loggingClass,
                         String loggingObjDesc,
                         AtofLogLevel level,
                         String logMsg,
                         String guid)
    {
        this.m_logMsg = logMsg;
        this.m_loggingClass = loggingClass == null ? "" : loggingClass;
        this.m_level = level.toString();
        this.m_guid = guid;
        this.m_loggingObjDesc = loggingObjDesc == null ? "" : loggingObjDesc;
        try {
            this.m_date =
                DateUtils.now("dd.MM.yy  hh:mm:ss");
        } catch (Exception ex) {
        }
    }


    public String getLevel()
    {
        return m_level;
    }


    public String getLoggingClass()
    {
        return m_loggingClass;
    }


    public String getLogMsg()
    {
        return m_logMsg;
    }


    public void setLevel(String level)
    {
        this.m_level = level;
    }


    public void setLoggingClass(String loggingClass)
    {
        this.m_loggingClass = loggingClass;
    }


    public void setLogMsg(String logMsg)
    {
        this.m_logMsg = logMsg;
    }


    public String getLoggingObjDesc()
    {
        return m_loggingObjDesc;
    }


    public void setLoggingObjDesc(String loggingObjDesc)
    {
        this.m_loggingObjDesc = loggingObjDesc;
    }


    @Override
    public String toString()
    {
        String logCls = (m_loggingClass.equals("") ? "" : "Class:" +
            m_loggingClass);
        String loggObj = (m_loggingObjDesc.equals("") ? "" : "Object Desc:" +
            m_loggingObjDesc);
        return "Date:" + getDate() + "   " +
            "Level:" + m_level + "   " +
            logCls + "   " +
            loggObj +
            "   " +
            "Message Id:" + getGuid() + "   " +
            "Message :" + m_logMsg;
    }


    @Override
    public void printMessage()
    {
        System.out.println("Msg:" + getLogMsg() +
                           " Date:" + getDate());
    }


    @Override
    public String getPrintMessage()
    {
        return "Msg:" + getLogMsg() +
            " Date:" + getDate();
    }
}
